package top.ahzy.seobench.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import top.ahzy.seobench.model.entity.ConfigData;

public interface ConfigDataMapper extends BaseMapper<ConfigData> {

    @Delete("DELETE FROM seo_config_data WHERE create_time >= date_add(CURDATE(), INTERVAL -30 DAY) AND NOT EXISTS (SELECT user_id, MAX(create_time) as create_time FROM seo_user GROUP BY user_id)")
    void delOldData();
}
